    <?php  include VIEWPATH.'common/head.php';  ?>
    <link href="<?php echo FONT_PATH.'static/bootstrap';?>/css/plugins/chosen/chosen.css" rel="stylesheet">
    <style>
        ul.chosen-results li{text-align:left !important;}
    </style>
    <!-- 日期组件 -->
    <link href="<?php echo FONT_PATH.'static/bootstrap/';?>css/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <script src="<?php echo FONT_PATH.'static/bootstrap/';?>js/bootstrap-datetimepicker.js"></script>
    <!-- 日期组件 -->
    <body class="gray-bg">
    <div class="add-btn" style="float:right;margin-bottom:5px;">
        <div class="modal fade" id="img_list" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
            <div class="modal-dialog" style="width: 60%;"><div class="modal-content"></div></div>
        </div>
    </div>
    <div class="add-btn" style="float:right;margin-bottom:5px;">
        <div class="modal fade" id="add_img" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
            <div class="modal-dialog" style="width: 60%;"><div class="modal-content"></div></div>
        </div>
    </div>
    <div class="clearfix"></div>

    <div class="wrapper wrapper-content ">
        <div class="add-btn" style="float:right;margin-bottom:5px;">
            <div class="modal fade" id="order_detail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
                <div class="modal-dialog" style="width: 80%;"><div class="modal-content"></div></div>
            </div>
        </div>

        <div class="add-btn" style="float:right;margin-bottom:5px;">
            <div class="modal fade" id="order_audit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
                <div class="modal-dialog" style="width: 50%;"><div class="modal-content"></div></div>
            </div>
        </div>
        <script>
            function js_in_array(id,id_arr) {
                for(var i=0;i<id_arr.length;i++){
                    if(id === id_arr[i]){
                        return true;
                    }
                }
                return false;
            }
        </script>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5><?php echo $pageTitle;?></h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div style="margin-top: 15px;">
                            <form class="form-horizontal" id="f_form" action="index.php?c=<?php echo $_REQUEST['c'];?>&m=<?php echo $_REQUEST['m'];?>" name="form" method="post">
                                <div class="form-group">

                                    <!--                                    查询类型-->
                                    <div class="col-sm-1">
                                        <select name="s_type_id" class="form-control">
                                            <option <?php echo $s_type_id==1?"selected":""?> value="1">帖子id</option>
                                            <option <?php echo $s_type_id==5?"selected":""?> value="5">评论id</option>
                                            <option <?php echo $s_type_id==2?"selected":""?> value="2">用户id</option>
                                            <option <?php echo $s_type_id==3?"selected":""?> value="3">评论标题</option>
                                            <option <?php echo $s_type_id==4?"selected":""?> value="4">用户昵称</option>
                                        </select>
                                    </div>
                                    <!--                                    查询内容-->
                                    <div class="col-sm-2">
                                        <input type="text" name="s_content" placeholder="请输入" class="input-sm form-control"  value="<?php echo $s_content;?>" autocomplete="off"/>
                                    </div>
                                    <div class="col-sm-1" style="text-align: right;line-height: 30px;padding: 0px;">评论来源：</div>
                                    <div class="col-sm-2">
                                        <!--                                        全部/茉莉导入/麻花导入/用户上传/运营上传/签约用户上传-->
                                        <select name="post_type" class="form-control">
                                            <option <?php echo $post_type==''?"selected":""?> value="">全部</option>
                                            <option <?php echo $post_type==1?"selected":""?> value="1">茉莉导入</option>
                                            <option <?php echo $post_type==2?"selected":""?> value="2">麻花导入</option>
                                            <option <?php echo $post_type==3?"selected":""?> value="3">用户发布</option>
<!--                                            <option disabled --><?php //echo $post_type==4?"selected":""?><!-- value="4">运营上传</option>-->
<!--                                            <option disabled --><?php //echo $post_type==5?"selected":""?><!-- value="5">签约用户上传</option>-->
                                        </select>
                                    </div>

                                    <div class="col-sm-1" style="text-align: right;line-height: 30px;padding: 0px;">是否有音频：</div>
                                    <div class="col-sm-2">
                                        <select name="is_audio" class="form-control">
                                            <option <?php echo $is_audio==''?"selected":""?> value="">全部</option>
                                            <option <?php echo $is_audio==1?"selected":""?> value="1">有</option>
                                            <option <?php echo $is_audio==2?"selected":""?> value="2">无</option>
                                        </select>
                                    </div>
                                    <div class="col-sm-12" style="text-align: right;line-height: 30px;padding: 0px;height: 15px;"></div>

                                    <!--                                    发布状态-->
                                    <div class="col-sm-1" style="text-align: right;line-height: 30px;padding: 0px;">发布状态：</div>
                                    <div class="col-sm-2">
                                        <select name="status" class="form-control">
                                            <option <?php echo $status==''?"selected":""?> value="">全部</option>
                                            <option <?php echo $status==1?"selected":""?> value="1">成功</option>
<!--                                            <option --><?php //echo $status==2?"selected":""?><!-- value="2">未通过</option>-->
                                            <option <?php echo $status==-1?"selected":""?> value="-1">删除</option>
                                        </select>
                                    </div>
                                    <!--                                    审核状态-->
                                    <div class="col-sm-1" style="text-align: right;line-height: 30px;padding: 0px;">审核状态：</div>
                                    <div class="col-sm-2">
                                        <select name="is_audit" class="form-control">
                                            <option <?php echo ($is_audit==''&&$is_audit!==0)?"selected":""?> value="">全部</option>
                                            <option <?php echo $is_audit==1?"selected":""?> value="1">已审核</option>
                                            <option <?php echo ($is_audit==2||$is_audit===0)?"selected":""?> value="2">待审核</option>
                                        </select>
                                    </div>

                                    <div class="col-sm-1">
                                        <button class="btn btn-sm btn-primary" type="submit"> 搜索 </button>
                                    </div>

                                </div>
                            </form>
                        </div>
                        <div>
                            <!-- Tab panes -->
                            <style>
                                <!--
                                .table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th{vertical-align:top;}
                                -->
                            </style>
                            <div class="tab-content">
                                <div role="tabpanel" class="tab-pane active" id="sellTab1">
                                    <style type="text/css">
                                        .tg  {border-collapse:collapse;border-spacing:0;}
                                        .tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;word-break:normal;border-color:black;}
                                        .tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;word-break:normal;border-color:black;}
                                        .tg .tg-us36{vertical-align:middle}
                                    </style>
                                    <table class="tg table table-bordered">
                                        <tr>
                                            <td  colspan="6">
                                                <span style="color: red">提示：如果需要修改评论内容，请直接点击评论内容处进行编辑，鼠标离开时自动保存！</span>
                                            </td>
                                        </tr>
                                        <tr style="background: #c8c8c8;">
                                            <th class="tg-us36" width="5%">
                                                id
                                            </th>
                                            <th class="tg-us36" width="23%">
                                                所属于帖子
                                            </th>
                                            <th class="tg-us36" width="30%">
                                                评论内容
                                            </th>
                                            <th class="tg-us36" width="7%">
                                                 评论类型
                                            </th>
                                            <th class="tg-us36" width="20%">
                                                 发布人信息
                                            </th>
                                            <th class="tg-us36" width="8%">
                                                 评论状态
                                            </th>
                                            <th class="tg-us36" width="7%">
                                                 操作
                                            </th>
                                        </tr>
                                        <?php
                                        if(!empty($list)){
                                            $sex = array(0 => "默认", 1 => "男", 2=>"女");
                                            foreach($list as $data){
                                        ?>
                                            <tr id="tr_<?php echo $data['id'];?>">
                                                <td><?php echo $data['id']?></td>
                                                <td>
                                                    <span style="color: red;"><?php echo $data['p_status'] == 2?"[未通过]":($data['p_status'] == 3?"[已删除]":"")?></span>
                                                    <a class="J_menuItem" data-names="帖子列表" href="index.php?c=post&m=post_list&&s_content=<?php echo $data['post_id']?>&s_type_id=1" target="_blank"><?php echo $data['p_title']?></a>
                                                </td>
                                                <td>
                                                    <textarea cols="55" rows="4" class="form-control update_desc" id="desc_<?php echo $data['id']?>" data-id="<?php echo $data['id']?>" data-desc="<?php echo $data['desc']?>"><?php echo $data['desc']?></textarea>
                                                </td>
                                                <td>
                                                    <?php
                                                    if($data['type']==1){echo "用户发布";}
                                                    if($data['type']==0){echo "机器人";}
                                                    if($data['type']==2){echo $data['source']?$data['source'].'导入':"未知导入";}
                                                    ?>
                                                    <br>
                                                    发布时间：
                                                    <?php echo date('Y-m-d H:i:s',$data['add_time']);?>
                                                </td>
                                                <td>
                                                    uid:<?php echo $data['uid']?>&nbsp;&nbsp;<span id="u_sex_<?php echo $data['uid'];?>"><?php echo "性别：".$sex[$data['sex']];?></span><br>
                                                    昵称：【<?php echo $data['nickname']?>】<br>
                                                    用户类型：
                                                    <?php
                                                    if($data['user_type']==1){echo "注册";}
                                                    if($data['user_type']==2){echo "机器人";}
                                                    if($data['user_type']==3){echo $data['user_source']?$data['user_source'].'导入':"未知导入";}
                                                    $user=$this->UserCount->query_one(array('uid'=>$data['uid']));
                                                    ?><br>
                                                    <a href="index.php?c=user&m=user_edit&uid=<?php echo $data['uid'];?>" data-toggle="modal" data-target="#img_list">编辑</a><br>
                                                    主帖：<a  class="J_menuItem" data-names="用户详情"  href="index.php?c=user&m=user_info&&uid=<?php echo $data['uid'];?>&op=post" target="_blank"><?php echo $user['pub_num'];?></a>
                                                    评论：<a  class="J_menuItem" data-names="用户详情" href="index.php?c=user&m=user_info&&uid=<?php echo $data['uid'];?>&op=reply" target="_blank"><?php echo $user['reply_num'];?></a><br>
                                                    积分/金币：<?php echo $user['gold_num'];?>
                                                    经验：<?php echo $user['experience'];?>
                                                    信誉：<?php echo $user['reputation'];?>
                                                </td>
                                                <td>
                                                    <span style="color: red;" class="is_audit_<?php echo $data['id'];?>">
                                                        <?php echo $data['is_audit'] == 1?"[已审核]":"待审核"?>
                                                    </span>
                                                    <span style="color: red;" class="status_<?php echo $data['id'];?>">
                                                        <?php echo $data['status'] == 2?"[未通过]":($data['status'] == -1?"[已删除]":"[已通过]")?>
                                                    </span>


                                                </td>
                                                <td>

                                                    <a class="del_<?php echo $data['id']?>" style="<?php echo ($data['status'] == 2 || $data['status'] == -1)?'display:none':''?>" onclick="del_comment('<?php echo $data['id']?>',1)">删除</a>
                                                    <br>
                                                    <br>
                                                    <a class="success_<?php echo $data['id']?>" style="<?php echo ($data['status'] == 2 || $data['status'] == -1)?'display:none':''?>" onclick="comment_success('<?php echo $data['id']?>')">审核通过</a>


<!--                                                    删除后显示-->
                                                    <a class="z_<?php echo $data['id']?>"  style="<?php echo ($data['status'] == 2 || $data['status'] == -1)?'':'display:none'?>" onclick="del_comment('<?php echo $data['id']?>',2)">恢复</a>
                                                </td>
                                            </tr>
                                                <tr>
                                                    <td  colspan="7" bgcolor="#e8e8e8" style="border-bottom: 3px solid #ff0000;padding: 0px;margin: 0px;height: 40px;line-height: 30px;">

                                                        <?php
                                                            if($data['audio_id']!=0){
                                                                $audio=array();
                                                                $audio=$this->AudioModel->query_one(array('id'=>$data['audio_id']));
                                                        ?>
                                                                <audio controls="controls"  preload="load" style="width:100%;">
                                                                    <source src="<?php echo $audio['audio_address']?>" type="audio/mpeg">
                                                                    <embed src="<?php echo $audio['audio_address']?>"  autostart="false" loop="false">
                                                                </audio>
                                                        <?php
                                                            }else{
                                                                echo "无音频";
                                                            }
                                                        ?>
                                                    </td>
                                                </tr>

                                        <?php }}?>
                                    </table>

                                    <div class="set_page">
                                        <?php
                                            if($status_s!==0){
                                                echo $multipage;
                                            }
                                        ?>
                                        <div class="clearfix"></div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="user_jin" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
        <div class="modal-dialog" style="width: 50%;">
            <div class="modal-content">
                <div class="tab-pane active" id="horizontal-form">

                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h2 class="modal-title">操作评论</h2>
                    </div>
                    <form class="form-horizontal" id="comment_form" action="index.php?c=comment&m=del_comment" name="form" method="post">
                        <input type="hidden" name="submits" value="1"/>
                        <input type="hidden" name="type" id="type" value="1"/>
                        <input type="hidden" name="comment_id" id="comment_id" value=""/>

                        <div class="form-group">
                            <label for="time_range" class="col-sm-2 control-label">禁止时间</label>
                            <div class="col-sm-3">
                                <select  name="tag_id" id="tag_id" class="form-control">
                                    <option value="">请选择原因</option>
                                    <?php
                                    $reportTag = $this->ReportModel->tag;
                                    foreach ($reportTag as $k=>$v){
                                        $str='<option value="'.$k.'">'.$v;
                                        $str.='</option>';
                                        echo $str;
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>

                        <div class="modal-footer">
                            <button type="reset" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button type="button" onclick="on_submit()" class="btn btn-primary">保存</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>


    </div>

    <script src="<?php echo FONT_PATH.'static/bootstrap';?>/js/plugins/chosen/chosen.jquery.js"></script>
    <script src="<?php echo FONT_PATH.'static/bootstrap';?>/js/demo/form-advanced-demo.min.js"></script>
    <script type="text/javascript">
        function comment_success(id) {
            $.ajax({
                type: 'post',
                url: "index.php?c=comment&m=comment_success",
                data: {'id': id},
                dataType: 'json',
                success: function (result) {
                    if (result['status'] == 1) {
                        alert("评论审核通过");
                        $('.is_audit_' + id + '').html('[已审核]');
                        $('.status_' + id + '').html('[审核通过]');
                        // $(''+y_class+'').hide();
                        // $(''+x_class+'').show();
                    } else {
                        alert("评论审核失败");
                    }
                }
            });
        }

        function del_comment(id,types) {
            if(types == 1){
                var str='已删除';
                var msg='确认删除吗';
                var y_class=".del_"+id;
                var x_class=".z_"+id;
            }else{
                var str='已恢复正常';
                var msg='确认恢复吗';
                var y_class=".z_"+id;
                var x_class=".del_"+id;

                $.ajax({
                    type: 'post',
                    url: "index.php?c=comment&m=del_comment",
                    data: {'id': id,'type':types},
                    dataType: 'json',
                    success: function (result) {
                        if (result['status'] == 1) {
                            alert("评论"+str);
                            $('.is_audit_' + id + '').html('[已审核]');
                            $('.status_' + id + '').html('['+str+']');
                            $(''+y_class+'').hide();
                            $(''+x_class+'').show();
                        } else {
                            alert("评论删除失败");
                        }
                    }
                });
                return false;
            }
            if(confirm(msg)) {
                $('#user_jin').modal('show');
                $('#comment_id').val(id);
            }
        }

        function on_submit(){
            var id = $("#comment_id").val();
            var types = $("#type").val();
            var tag_id = $("#tag_id").val();
            if(tag_id == ''){
                alert("请选择删除原因");
                return false;
            }
            var str='已删除';
            var msg='确认删除吗';
            var y_class=".del_"+id;
            var x_class=".z_"+id;
            $.ajax({
                type: 'post',
                url: "index.php?c=comment&m=del_comment",
                data: {'id': id,'type':types,'tag_id':tag_id},
                dataType: 'json',
                success: function (result) {
                    if (result['status'] == 1) {
                        alert("评论"+str);
                        $('.is_audit_' + id + '').html('[已审核]');
                        $('.status_' + id + '').html('['+str+']');
                        $(''+y_class+'').hide();
                        $(''+x_class+'').show();
                        $('#user_jin').modal('hide');

                    } else {
                        alert("评论删除失败");
                    }
                }
            });
            return true;
            // $("#comment_form").submit();
        }
        $("#user_jin").on("hidden.bs.modal", function() {
            $(this).removeData("bs.modal");
        })
        $(function () {
            $('.update_desc').blur(function () {
                var id=$(this).attr('data-id');
                var data_desc=$(this).attr('data-desc');
                var desc=$(this).val();
                var t=$(this);
                if(data_desc == desc){
                    return false;
                }
                $.ajax({
                    type:'post',
                    url:"index.php?c=comment&m=up_desc",
                    data:{'id':id,'desc':desc},
                    dataType:'json',
                    success:function(result){
                        if(result['status'] == 1){
                            // status.css({'color':'red'});
                            console.log(t);
                            t.attr('data-desc',desc)
                        }else{
                            alert("审核不通过失败")
                        }
                    }
                });
            });
        })

    </script>

    <script type="text/javascript">
        $(function () {

            function getDate(num) {
                var t =  24*3600*1000;
                var n = new Date()*1;
                return new Date(n +  num*t).toLocaleDateString().replace(/\//g,'-');
            }
            function setDateRange(type) {
                var $start=$('#use_time1 input');
                var $end=$('#use_time2 input');
                switch(type){
                    case 'dm':
                        $start.val(getDate(-1*(new Date().getDate())+1));
                        $end.val(getDate(0));
                        break;
                    case 'd1':
                        $start.val(getDate(-1));
                        $end.val(getDate(-1));
                        break;
                    case 'd7':
                        $start.val(getDate(-7));
                        $end.val(getDate(0));
                        break;
                    case 'd30':
                        $start.val(getDate(-30));
                        $end.val(getDate(0));
                        break;
                }
            }
            $('#use_time1,#use_time2,#add_time1,#add_time2').datetimepicker({
                language: 'zh-CN',
                minView: "month",
                format:'yyyy-mm-dd',
                initialDate: new Date(),
                autoclose: true,
                todayBtn: true,
            });
            //setDateRange('dm');
            $(".time-range").bind('click',function () {
                setDateRange($(this).data('type'));
            })
        })
    </script>
    <script src="http://gosspublic.alicdn.com/aliyun-oss-sdk-4.4.4.min.js"></script>

<?php  include VIEWPATH.'common/footer.php';  ?>